<template>
  <div>
    <div class="card-list2" @click="showModal">
      <div class="card-left2">
        <div class="image2">
          <img :src="icons.ry" />
        </div>
        <div class="cont2">添加销售人员</div>
      </div>
      <div class="card-right2">
        <img class="image-right" :src="icons.right" />
      </div>
    </div>
    <div class="warp">
      <div class="card-list">
        <div class="card" v-for="item in datas" :key="item.wyid">
          <div class="spa1">
            <div>{{ item.dyuserid }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import store from "@/store/store";

export default {
  name: "Index",
  data() {
    return {
      icons: {
        ry: require(`@/common/image/ry.png`),
        right: require(`@/common/image/right-icon2.png`)
      },
      pageNum: 1,
      pageSize: 20,
      datas: []
    };
  },
  computed: {
    companyId() {
      return store.state.companyId;
    }
  },
  methods: {
    showModal() {
      const url = "/pages/addSellers/index";
      this.mpvue.navigateTo({ url });
    },
    getData() {
      const url = store.state.server + "/auth/getMemberList";
      this.mpvue.request({
        url: url,
        methods: "post",
        data: {
          wyid: this.companyId,
          pageSize: this.pageSize,
          pageNum: this.pageNum
        },
        success: res => {
          const { list } = res.data;
          this.datas = list;
        },
        fail: error => {
          uni.alert({
            content: error.errorMessage
          });
        }
      });
    }
  },
  onShow() {
    this.getData();
  },
  onReachBottom() {
    this.pageNum++;
    this.getData();
  }
};
</script>

<style scoped lang="scss">
@import "../../common/common";

div {
  box-sizing: border-box;
}

.bs {
  margin: 10px 0;
}

.warp {
  display: flex;
  background-color: #e3e3e3;
  height: 100vh;
  width: 100vw;
  flex-direction: column;
  box-sizing: border-box;
  overflow: auto;
}
.card-list {
  background-color: #fff;
  padding: 20px 15px;
  .card {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    .spa1 {
      display: flex;
      justify-content: space-between;
    }
    .spa2 {
      display: flex;
      align-items: center;
      justify-content: space-between;
      .d1 {
        font-size: 15px;
      }
      .d2 {
        color: #03a0de;
        font-size: 13px;
      }
    }
  }
}

.card-list2 {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  font-size: 18px;
  align-items: center;
  height: 50px;
  justify-content: space-between;
  cursor: pointer;

  .card-left2 {
    display: flex;
    align-items: center;
  }

  .image2 {
    width: 30px;
    height: 30px;
    margin-right: 20px;
    /*border: 1px solid #000;*/

    img {
      width: 100%;
      height: 100%;
    }
  }

  .cont2 {
    color: #333;
    font-weight: lighter;
  }

  .image-right {
    width: 8px;
    height: 14px;
  }
}
</style>
